import os
import sys

def load_modules(MODULES, DEBUG):
    
    #get current path where the bot is running and prepare to import modules dir
    sys.path.append( os.getcwd() + '/modules' )
    module_path = os.getcwd() + '/modules'

    modules = []
    for module in MODULES.split(','):
         if DEBUG == True:
            print module
            
        modules.append(__import__('%s' %(module), globals(), locals(), ['%s' %(module)]))

    return modules

def reload_modules(MODULES, DEBUG):
    
    #get current path where the bot is running and prepare to import modules dir
    sys.path.append( os.getcwd() + '/modules' )
    module_path = os.getcwd() + '/modules'

    modules = []
    for module in MODULES.split(','):
         if DEBUG == True:
            print "reloading " + module
        modules.append(__import__('%s' %(module), globals(), locals(), ['%s' %(module)]))

    return modules
